{% if isFramework("vue") %}

The grid api can be accessed via `this.$refs.myGrid.api` where `ref="myGrid"` is applied to the `ag-grid-vue` component. This will only be defined after the grid has been initialised.

```jsx
<ag-grid-vue ref="myGrid" />

// methods
onClick() {
    this.$refs.myGrid.api.deselectAll();
},
```

### API within Events and Callbacks

The `api` is also provided on the params for all grid events and callbacks. The first event fired is the `gridReady` event and that can be used to store a reference to the api within your component as an alternative to using `$refs`.

```jsx
<ag-grid-vue @grid-ready="onGridReady" />

// Store the api for later use
onGridReady = (params) => {
    this.api = params.api;
}
```

{% warning %}
If the API is being stored in a reference, it must be a `shallowRef` rather than a `ref` in order to work correctly.
{% /warning %}

{% /if %}
